(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[      6529,        174]
NotebookOptionsPosition[      5993,        151]
NotebookOutlinePosition[      6427,        170]
CellTagsIndexPosition[      6384,        167]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
 StyleBox["\:6c42\:89e3\:53cd\:5c04", "Title"]], "Input",
 CellFrame->{{0, 0}, {0.5, 0}},
 CellGroupingRules->{"GroupTogetherGrouping", 10000.},
 CellChangeTimes->{{3.817331932618697*^9, 3.8173319460104628`*^9}, 
   3.817348546926899*^9, {3.817357762925655*^9, 3.8173577657199345`*^9}, 
   3.817521823174597*^9, 3.817616139023605*^9, 3.817618174598412*^9, 
   3.817690181898816*^9, {3.818310059332364*^9, 3.8183100669521265`*^9}},
 TextAlignment->Center],

Cell[BoxData[
 StyleBox["\:5b9a\:4e49\:573a\:666f", "Subsection"]], "Input",
 TextAlignment->Center],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"reflectRay", "[", 
    RowBox[{"ray_", ",", "normal_"}], "]"}], "=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{"ray", "-", 
     RowBox[{"2", 
      RowBox[{"Dot", "[", 
       RowBox[{"ray", ",", "normal"}], "]"}], "*", "normal"}]}], 
    "\[IndentingNewLine]", ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{"Manipulate", "[", "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{
    RowBox[{"rayStart", "=", "p"}], ";", "\[IndentingNewLine]", 
    RowBox[{"rayEnd", "=", 
     RowBox[{"{", 
      RowBox[{"0", ",", "0"}], "}"}]}], ";", "\[IndentingNewLine]", 
    RowBox[{"normalStart", "=", 
     RowBox[{"{", 
      RowBox[{"0", ",", "0"}], "}"}]}], ";", "\[IndentingNewLine]", 
    RowBox[{"normalEnd", "=", 
     RowBox[{"{", 
      RowBox[{"0", ",", "1"}], "}"}]}], ";", "\[IndentingNewLine]", 
    RowBox[{"v", "=", 
     RowBox[{"rayEnd", "-", "rayStart"}]}], ";", "\[IndentingNewLine]", 
    RowBox[{"n", "=", 
     RowBox[{"normalEnd", "-", "normalStart"}]}], ";", "\[IndentingNewLine]", 
    RowBox[{"reflect", "=", 
     RowBox[{"reflectRay", "[", 
      RowBox[{"v", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
    RowBox[{"Graphics", "[", 
     RowBox[{
      RowBox[{"{", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"Arrow", "[", 
         RowBox[{"{", 
          RowBox[{"rayStart", ",", "rayEnd"}], "}"}], "]"}], ",", 
        "\[IndentingNewLine]", 
        RowBox[{"Arrow", "[", 
         RowBox[{"{", 
          RowBox[{"normalStart", ",", "normalEnd"}], "}"}], "]"}], ",", 
        "\[IndentingNewLine]", 
        RowBox[{"Arrow", "[", 
         RowBox[{"{", 
          RowBox[{"normalStart", ",", "reflect"}], "}"}], "]"}]}], "}"}], ",",
       "\[IndentingNewLine]", 
      RowBox[{"Axes", "\[Rule]", "True"}], ",", 
      RowBox[{"PlotRange", "\[Rule]", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{
           RowBox[{"-", "0.2"}], ",", "1"}], "}"}]}], "\[IndentingNewLine]", 
        "}"}]}]}], "]"}]}], ",", "\[IndentingNewLine]", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"p", ",", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "}"}], ",", "Locator"}], 
    "}"}]}], "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]"}], "Input",
 CellChangeTimes->{{3.8183102152389536`*^9, 3.8183102418976192`*^9}, {
  3.8206199858269253`*^9, 3.820620021044447*^9}}],

Cell[BoxData[
 TagBox[
  StyleBox[
   DynamicModuleBox[{$CellContext`p$$ = {-0.532, 0.552}, Typeset`show$$ = 
    True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", 
    Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = 
    "\"\:65e0\:6807\:9898\"", Typeset`specs$$ = {{{
       Hold[$CellContext`p$$], {-1, 1}}, Automatic}}, Typeset`size$$ = {
    468., {138., 146.}}, Typeset`update$$ = 0, Typeset`initDone$$, 
    Typeset`skipInitDone$$ = True}, 
    DynamicBox[Manipulate`ManipulateBoxes[
     1, StandardForm, "Variables" :> {$CellContext`p$$ = {-1, 1}}, 
      "ControllerVariables" :> {}, 
      "OtherVariables" :> {
       Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, 
        Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, 
        Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$,
         Typeset`skipInitDone$$}, 
      "Body" :> ($CellContext`rayStart = $CellContext`p$$; \
$CellContext`rayEnd = {0, 0}; $CellContext`normalStart = {0, 
         0}; $CellContext`normalEnd = {0, 
         1}; $CellContext`v = $CellContext`rayEnd - $CellContext`rayStart; \
$CellContext`n = $CellContext`normalEnd - $CellContext`normalStart; \
$CellContext`reflect = $CellContext`reflectRay[$CellContext`v, \
$CellContext`n]; Graphics[{
          Arrow[{$CellContext`rayStart, $CellContext`rayEnd}], 
          Arrow[{$CellContext`normalStart, $CellContext`normalEnd}], 
          Arrow[{$CellContext`normalStart, $CellContext`reflect}]}, Axes -> 
         True, PlotRange -> {{-1, 1}, {-0.2, 1}}]), 
      "Specifications" :> {{{$CellContext`p$$, {-1, 1}}, Automatic, 
         ControlType -> Locator}}, "Options" :> {}, "DefaultOptions" :> {}],
     ImageSizeCache->{539., {180., 189.}},
     SingleEvaluation->True],
    Deinitialization:>None,
    DynamicModuleValues:>{},
    SynchronousInitialization->True,
    UndoTrackedVariables:>{Typeset`show$$, Typeset`bookmarkMode$$},
    UnsavedVariables:>{Typeset`initDone$$},
    UntrackedVariables:>{Typeset`size$$}], "Manipulate",
   Deployed->True,
   StripOnInput->False],
  Manipulate`InterpretManipulate[1]]], "Output",
 CellChangeTimes->{{3.8183102259000196`*^9, 3.818310246847114*^9}, {
  3.8206200065389967`*^9, 3.8206200225015926`*^9}}]
}, Open  ]]
},
WindowToolbars->"EditBar",
WindowSize->{784, 810},
WindowMargins->{{Automatic, 0}, {Automatic, 0}},
CellContext->Notebook,
Magnification:>1.3 Inherited,
FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (2016\:5e7410\:67088\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 468, 8, 96, "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[1029, 30, 100, 2, 49, "Input"],
Cell[CellGroupData[{
Cell[1154, 36, 2552, 67, 691, "Input"],
Cell[3709, 105, 2268, 43, 422, "Output"]
}, Open  ]]
}
]
*)

